﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<TestWeb.Models.ViewModel>" %>

<script src="../../../Scripts/popup-jquery.js" type="text/javascript"></script>
<script src="../../../Scripts/ckeditor/ckeditor.js" type="text/javascript"></script>
<script src="../../../Scripts/jquery.filestyle.js" type="text/javascript"></script>

<!-- start table-content  -->
<div id="table-content">
    <!--  start message-blue -->
	<div id="message-blue">
		<table border="0" width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td class="blue-left">Information message</td>
			</tr>
		</table>
	</div>
    <!--  end message-blue -->
    <script type="text/javascript">
            <% if (ViewData["MsgTxt"] != null && ViewData["MsgTxt"] != string.Empty)
            { %>
		        $(".blue-left").text('<%= ViewData["MsgTxt"] %>');
                $("#message-blue").fadeIn('fast').delay(<%= WebConfiguration.Instance.InfoTime %>).fadeOut('slow'); 
	        <% } %>
    </script>

	<!-- start product-table -->
	<table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
		<tr>
            <th class="table-header-check line-left">
				<a href="#">HinhMinhHoa</a>
			</th>
            <th class="table-header-check line-left">
				<a href="#">ID</a>
			</th>
			<th class="table-header-repeat line-left">
				<a href="#">TieuDe</a>
			</th>
            <th class="table-header-repeat line-left">
				<a href="#">NoiDungRutGon</a>
			</th>
			<th class="table-header-options line-left">
				<a href="#">Option</a>
			</th>
		</tr>
	<% for (int i = 0; i < Model.TinTucs.Count; i++)
	{
		var item = Model.TinTucs[i]; %>
		<% if (i % 2 == 0)
		{ %>
		<tr id="row-<%= item.ID %>" class="row-table odd-row">
		<% }
		else
		{ %>
		<tr id="row-<%= item.ID %>" class="row-table even-row">
		<% } %>
            <td>
                <img src="../../../Content/UploadImages/<%= item.HinhMinhHoa %>" width="90px" height="90px" />
            </td>
            <td>
				<%= item.ID %>
			</td>
			<td>
				<%= item.TieuDe %>
			</td>
            <td>
				<%= item.NoiDung.StripTags().Truncate(WebConfiguration.Instance.NumCharsOfShortDescription) %>
			</td>
			<td class="options-width">
                <%= Ajax.ActionLink(" ", "DetailOfTinTuc", new { ID = item.ID, CurrentPage = (int)ViewData["CurrentPage"] }, new AjaxOptions { OnComplete = "ShowPopupDialog_OnComplete" }, new { @class = "icon-5 info-tooltip", @title = "Select" })%>
                <%= Ajax.ActionLink(" ", "DeleteTinTuc", "Admin", new { id = item.ID }, new AjaxOptions { Confirm = "Are you sure you want to Delete it? This action cannot be undone.", HttpMethod = "Delete", OnComplete = "jsonDelete_OnComplete" }, new { @class = "icon-2 info-tooltip", @title = "Delete" })%>
			</td>
		</tr>
	<% } %>
	</table>
	<!-- end product-table -->
	<!-- start paging -->
	<div class="pagination">
	<% 
		var nextPage = (int)ViewData["CurrentPage"] + 1;
		var totalPage = (int)ViewData["TotalPage"];
		if (nextPage <= totalPage)
		{ %>
	    <%= Html.ActionLink(" ", "SelectTinTucByLoaiTinTuc", new { IDLoaiTinTuc = Model.LoaiTinTucs[0].ID, Page = nextPage })%>
	 <% } %>
	</div>
	<!-- end paging -->
    
    <!-- The HTML for displaying the pop-up dialog to update data -->
    <div id="overlay" class="web_dialog_overlay"></div>
    <div id="dialog" class="web_dialog">
        <table style="width: 100%; border: 0px;" cellpadding="3" cellspacing="0">
            <tr style="position: fixed;">
                <td class="web_dialog_title">TinTuc Management</td>
                <td class="web_dialog_title align_right">
                    <a href="#" id="btnClose">Close</a>
                </td>
            </tr>
            <tr style="height: 40px;">
                <td>&nbsp;</td>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <td colspan="2">
                    <div id="detail-info"></div>
                </td>
            </tr>
        </table>
    </div>
</div>
<!-- end content-table  -->